Repository navigation
Add assy imprint method - #2128
adam-urbanczyk wants to merge 2 commits into
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2128 +/- ##
==========================================
- Coverage 95.81% 95.59% -0.22%
==========================================
Files 30 30
Lines 9605 9634 +29
Branches 1443 1447 +4
==========================================
+ Hits 9203 9210 +7
- Misses 247 269 +22
Partials 155 155 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
paramak's remove() matched parts with endswith('/<name>') on the names
yielded by iterating the assembly. CadQuery/cadquery#2128 changes those
names so direct children of the root no longer carry the root prefix,
which would make remove() silently return the full assembly.
cadquery has had Assembly.remove since 2.6.0 (paramak's floor). It
removes the part in place by its key, keeps nested structure and raises
ValueError for an unknown name. Drop the override and test cadquery's
method on plain assemblies, nested sub-assemblies and a full reactor.
|
this looks useful for a few workflows in cad-to-dagmc where i have functions that take assemblies and imprint them. It might be useful to allow the assembly to know if it has been imprinted or know so that if imprinted assemblies are passed around the receiver does not accidentally imprint them again I was looking into how this improves my upstream codes and got a few keyerrors that might be worth considering |
|
KeyError when a part (or a named sub-shape) is not changed by the imprint import cadquery as cq
a = cq.Assembly()
a.add(cq.Workplane().box(10, 10, 10).val(), name="p0")
a.add(cq.Workplane().transformed(offset=(50, 0, 0)).box(10, 10, 10).val(), name="p1")
a.imprint() # KeyError |
|
Parts with a loc are moved twice and lose their shared faces a = cq.Assembly()
a.add(cq.Workplane().box(10, 10, 10).val(), name="a")
a.add(cq.Workplane().box(10, 10, 10).val(), name="b", loc=cq.Location((10, 0, 0)))
a.imprint()
# "b" now spans x 15..25 (should be 5..15), and the compound has 12 faces instead of 11 |
|
Thanks @shimwell , this is still a draft. I would not yet recommend testing. |
Fixes #2075